package lq1458;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/*
lq1458,60%
输入数据：
3 3
0 3
1 2
0 2

输出：
3 1 2
*/

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		//原始数组
		//使用Arrays.sort用Integer类型
		Integer[] a = new Integer[n+1];
		for(int i=0;i<=n;i++)
			a[i] = i;
		
		//m次操作
		for(int k=0;k<m;k++) {
			int pi = sc.nextInt();
			int qi = sc.nextInt();
			
			//排序操作
			if(pi==0) {
				//a数组[1...qi]降序
				/*
					Arrays.sort(a,fromIndex,toIndex,c)
					a - the array to be sorted
					fromIndex - the index of the first element (inclusive) to besorted
					toIndex - the index of the last element (exclusive) to be sorted
					c - the comparator to determine the order of the array. 
					注意toIndex下标元素是不算在排序中的
				 */
				Arrays.sort(a, 1, qi+1, new Comparator<Integer>() {
		        	@Override
					public int compare(Integer o1, Integer o2) {
						if (o1 - o2 >= 0) {//比较数组元素值
		                    return -1;  //o1大时，返回负数表示o1往前排，降序
		                } else {
		                    return 1;
		                }
					}
		        });
			}else if(pi==1) {
				//a数组[qi...n]升序
				Arrays.sort(a,qi,n+1);
			}
		}
		
		//输出
		for(int i=1;i<=n;i++) {
			System.out.printf("%d ", a[i]);
		}
		System.out.println();
	}

}
